package View;

import Client.Client;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JTabbedPane;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

/**
 *
 * @author CCD gruppe 2
 * 
 */
public class MainFrame extends JFrame {


    private ChatPanel chatPanel;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JMenu userAdministrationMenu;
    private javax.swing.JMenu projectMenu;
    private javax.swing.JMenu resourceMenu;
    private MainSessionPanel mainPanel;
    private MainSessionPanel mainSessionPanel;
    private javax.swing.JMenuBar jMenuBar1;
    private ActivityTabPanel activityTabPanel;
    private WelcomeTabPanel welcomeTabPanel;
    Dimension screenDim = Toolkit.getDefaultToolkit().getScreenSize();

    public MainFrame() {
                
        initComponents();
    }

    private void initComponents() {
        chatPanel = new ChatPanel();
        activityTabPanel = new ActivityTabPanel();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        mainSessionPanel = new MainSessionPanel();
        welcomeTabPanel = new WelcomeTabPanel();
        jMenuBar1 = new javax.swing.JMenuBar();
        projectMenu = new javax.swing.JMenu();
        userAdministrationMenu = new javax.swing.JMenu();
        resourceMenu = new javax.swing.JMenu();
        jTabbedPane1.addTab("Forberedelse", welcomeTabPanel);
        jTabbedPane1.addTab("Chat", chatPanel);
        jTabbedPane1.addTab("Sesjoner", mainSessionPanel);
        jTabbedPane1.addTab("Aktiviteter", activityTabPanel);

        projectMenu.setText("Prosjektmeny");
        jMenuBar1.add(projectMenu);
        userAdministrationMenu.setText("Brukeradministrasjon");
        jMenuBar1.add(userAdministrationMenu);
        resourceMenu.setText("Ressurser");
        jMenuBar1.add(resourceMenu);
        setJMenuBar(jMenuBar1);
        setDefaultCloseOperation(EXIT_ON_CLOSE);

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(jTabbedPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 1000, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(48, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(jTabbedPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 743, Short.MAX_VALUE))
        );
        pack();
        setVisible(false);
        setCenterPos(this);

        jTabbedPane1.setSelectedIndex(0);

    }// </editor-fold>

        private static void setCenterPos(JFrame frame) {
        Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
        int x = (int) ((screen.getWidth() - frame.getWidth()) / 2);
        int y = (int) ((screen.getHeight() - frame.getHeight()) / 2);
        frame.setLocation(x, y);
    }

 /*   private static void setCenterPos(JFrame frame) {
        Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
        int height = (int) (screen.getHeight() * 0.80);
        int width = (int) (screen.getWidth() * 0.80);
        frame.setSize(width, height);

        int x = (int) ((screen.getWidth() - frame.getWidth()) / 2);
        int y = (int) ((screen.getHeight() - frame.getHeight()) / 2);


        frame.setLocation(x, y + 25);

    }*/

    /*
     * Getters and setters
     */

    public JTabbedPane getjTabbedPane1() {
        return jTabbedPane1;
    }

    public MainSessionPanel getMainSessionPanel() {
        return mainSessionPanel;
    }

    public void setMainPanel(MainSessionPanel newMainPanel){
        this.mainSessionPanel = newMainPanel;
    }

    public ChatPanel getChatPanel(){
        return chatPanel;
    }

    public JMenu getUserAdministrationMenu() {
        return userAdministrationMenu;
    }

    public void setChatPanel(ChatPanel chatPanel) {
        this.chatPanel = chatPanel;
    }

    public void setjTabbedPane1(JTabbedPane jTabbedPane1) {
        this.jTabbedPane1 = jTabbedPane1;
    }

    public void setUserAdministrationMenu(JMenu userAdministrationMenu) {
        this.userAdministrationMenu = userAdministrationMenu;
    }

    public void setProjectMenu(JMenu projectMenu) {
        this.projectMenu = projectMenu;
    }

    public ActivityTabPanel getActivityTabPanel() {
        return activityTabPanel;
    }

    public JMenuBar getjMenuBar1() {
        return jMenuBar1;
    }

    public void setjMenuBar1(JMenuBar jMenuBar1) {
        this.jMenuBar1 = jMenuBar1;
    }

    public JMenu getProjectMenu() {
        return projectMenu;
    }

    public void setProjectMeny(JMenu projectMenu) {
        this.projectMenu = projectMenu;
    }

    public JMenu getResourceMenu() {
        return resourceMenu;
    }

    public void setResourceMenu(JMenu resourceMenu) {
        this.resourceMenu = resourceMenu;
    }

    public WelcomeTabPanel getWelcomeTabPanel(){
        return welcomeTabPanel;
    }

  

}
